home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Online / Epic4 / share / epic / help / 6_functions / sar < prev    next >
Text File  |  2001-03-21  |  1KB  |  34 lines

  1. Synopsis:
  2.    $sar([i][g][r]/<search>/<replace>/<text>)
  3.  
  4. Technical:
  5.    This function searches for the given search string in the given text, and
  6.    replaces if with the replacement text, if a match is found.  The field
  7.    delimiter may be any character; the first character found that is not a
  8.    'g' or 'r' is used.
  9.  
  10. Practical:
  11.    This is the general purpose search-and-replace function.  It allows you
  12.    to look for any arbitrary text substring in any text string, and replace
  13.    it with another arbitrary substring.  Any of the strings may consist of
  14.    variables to expand at runtime.
  15.  
  16. Returns:
  17.    resultant string
  18.  
  19. Options:
  20.    i    do case-insensitive searches
  21.    g    replace all matches, not just the first
  22.    r    assume text is a variable name; assign return value to variable
  23.  
  24. Examples:
  25.    @ foo = [foobarblah]
  26.    $sar(/oo/ee/booyamon)              returns "beeyamon"
  27.    $sar(/oo/ee/foofoo)                returns "feefoo"
  28.    $sar(g/oo/ee/foofoo)               returns "feefee"
  29.    $sar(r/oo/ee/foo)                  returns and sets $foo to "feebarblah"
  30.  
  31. See Also:
  32.    tr(6); msar(6)
  33.  
  34.